# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年08月24日
"""
from docx import Document
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT # 对齐
from docx.shared import Pt # 单位


file = Document('./练习/17结果03.docx')
sec1 = file.sections[0] # 获取第一个节的对象
print('首页不同默认状态:', sec1.different_first_page_header_footer)
sec1.different_first_page_header_footer = True
first_page = sec1.first_page_header
hd = first_page.paragraphs[0].add_run('这是首页')
hd.font.size = Pt(12)
first_page.paragraphs[0].alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
first_page = sec1.first_page_footer
hd = first_page.paragraphs[0].add_run('这是首页页脚')



file.save('./练习/20结果02.docx')
